-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always relate with Invariant to non-General inference vars #659
Conversation
…other, relate with invariance instead
Rustc doesn't unify inference variables with subtype bounds: Looking at unification, the only difference here with rustc in this area is that |
Ugh yeah, that's what I was missing and what the proper change is. |
Actually, that alone is not enough to make the test pass :/ |
I'm not sure if the test case with two arbitrary variables needs to pass. One of the variables will eventually be resolved if the program is going to compile. |
I wondered about that. I did test with the original test from @flodiebold with the |
I don't love this solution. Like @matthewjasper, I'm not sure that the test with two arbitrary variables needs to pass. @jackh726 can you share what you tried with integer variables? In rustc, we definitely consider integer variables "more specific" than normal variables (so e.g. a general variable would be "assigned" the value of an integer variable). |
Yeah, I updated. |
So, to elaborate on why only always unifying non-general inference vars doesn't work: From there, we try to unify By this point, when we unify |
Okay, so we probably just need to actually resolve inference vars when trying to simplify a subtype goal... |
Okay so that worked. |
oops, I forgot, we use bors now don't we... d'oh |
Fixes #658
An alternative way to approach this is to always unify inference variables as
Invariant
, which is how it's implemented in rustc right now. We should think about if we want that long term though (and possibly come up with tests that hit that).